<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button onclick="send()">发送异步请求</button>
    <script src="jquery-3.6.1.js"></script>
    <script>
      function send() {
        $.ajax({
          async: true, // 是否是异步请求，true 表示异步【默认】
          url: "http://localhost/test", // 请求的地址
          type: "post", // 请求方式
          data: {
            username: "zhangsan",
            password: "1234567",
          }, // 请求的数据
          //   success: fucntion(repsonse){

          //   },
          success: function (result, status, xhr) {
            console.log(result);
            console.log(status);
            console.log(xhr);
          }, // 请求成功的回调
          error: function (error, xhr, status) {
            console.error(error);
            console.error(xhr);
            console.error(status);
          }, // 请求失败回调
        });

        $.get({
          url: "",
          data: {},
          success: function (repsonse) {},
        });

        $.post({
          url: "",
          data: {},
          success: function (repsonse) {},
        });
      }
    </script>
  </body>
</html>
